| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Public Member Functions | Static Public Member Functions | List of all members
nkWinUi::Image Class Referenceabstract

Abstracts an image to be used within the component. More...

## Public Member Functions
| Image () noexcept
virtual | ~Image ()
virtual unsigned int | getWidth () const =0
virtual unsigned int | getHeight () const =0
nkMemory::StringView | getName () const
bool | getHidden () const
void | setName (nkMemory::StringView value)
void | setHidden (bool value)
void | setFromImage (const nkImages::ImageView &image)
void | setFromImageCopy (const nkImages::ImageView &image)
void | setFromImageForward (nkImages::Image &&image)
virtual bool | load ()=0
virtual void | unload ()=0
bool | reload ()

## Static Public Member Functions
static nkMemory::UniquePtr< Image > | create (System *system=nullptr)

## Detailed Description

Abstracts an image to be used within the component.

## Constructor & Destructor Documentation

## ◆ Image()

nkWinUi::Image::Image | ( |  | ) |
| noexcept

Constructor.

## ◆ ~Image()

virtual nkWinUi::Image::~Image | ( |  | ) |
| virtual

Destructor.

## Member Function Documentation

## ◆ getWidth()

virtual unsigned int nkWinUi::Image::getWidth | ( |  | ) | const
| pure virtual

Returns
  The width, in pixels, of the image.

## ◆ getHeight()

virtual unsigned int nkWinUi::Image::getHeight | ( |  | ) | const
| pure virtual

Returns
  The height, in pixels, of the image.

## ◆ getName()

nkMemory::StringView nkWinUi::Image::getName | ( |  | ) | const

Returns
  The name of the image.

## ◆ getHidden()

bool nkWinUi::Image::getHidden | ( |  | ) | const

Returns
  Whether the resource is hidden (true), or not (false).

## ◆ setName()

void nkWinUi::Image::setName | ( | nkMemory::StringView | value | ) |

Sets the name of the image to use. Usually used internally through the manager.

Parameters

  value | The name to assign to the image.

## ◆ setHidden()

void nkWinUi::Image::setHidden | ( | bool | value | ) |

Sets whether the image is hidden or not. A hidden image will not be discoverable by the getByIndex method of the manager.

Parameters

  value | Whether the image should be hidden (true) or not (false).

## ◆ setFromImage()

void nkWinUi::Image::setFromImage | ( | const nkImages::ImageView & | image | ) |

Sets the source image to use. This version will only take a view that should remain alive during the entire load process.

Parameters

  image | The image to use as source.

## ◆ setFromImageCopy()

void nkWinUi::Image::setFromImageCopy | ( | const nkImages::ImageView & | image | ) |

Sets the source image to use. This version will copy the image into an owned memory space.

Parameters

  image | The image to use as source.

## ◆ setFromImageForward()

void nkWinUi::Image::setFromImageForward | ( | nkImages::Image && | image | ) |

Sets the source image to use. This version will take ownership of the provided image.

Parameters

  image | The image to use as source.

## ◆ load()

virtual bool nkWinUi::Image::load | ( |  | ) |
| pure virtual

Loads the image, creating and filling all the structures it needs to work in the component.

Returns
  Whether the image could load correctly (true) or not (false).

## ◆ unload()

virtual void nkWinUi::Image::unload | ( |  | ) |
| pure virtual

Unloads the image and frees the underlying allocated resources.

## ◆ reload()

bool nkWinUi::Image::reload | ( |  | ) |

Reloads the resources, automating an unload call followed by a load one.

Returns
  Whether the image could reload correctly (true) or not (false).

## ◆ create()

static nkMemory::UniquePtr<Image> nkWinUi::Image::create | ( | System * | system = `nullptr` | ) |
| static

Creates a standalone resource, linking it to a system, but no manager. This method can be used to allocate a resource and manually manage its lifetime.

Parameters

  system | The system to create the resource into. If left to nullptr, then the Singleton instance will be used.

Returns
  The created resource instance.

The documentation for this class was generated from the following file:

- Documentation/Headers/NilkinsWinUi/Images/Image.h